<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" href="summernote/bootstrap.css">

<!-- 上传控件 -->
<link href="js/fileupload/css/fileinput.css" media="all" rel="stylesheet" type="text/css"/>
<link href="../../../js/fileupload/css/font-awesome.min.css" media="all" rel="stylesheet" type="text/css"/>
<link href="js/fileupload/themes/explorer-fa/theme.css" media="all" rel="stylesheet" type="text/css"/>

<!-- include jquery -->
<script src="summernote/jquery.js"></script>

<script src="js/fileupload/js/plugins/sortable.js" type="text/javascript"></script>
<script src="js/fileupload/js/fileinput.js" type="text/javascript"></script>
<script src="js/fileupload/js/locales/zh.js" type="text/javascript"></script>
<script src="js/fileupload/themes/explorer-fa/theme.js" type="text/javascript"></script>


<!-- include libraries BS -->
<script src="summernote/bootstrap.js"></script>


<script type="text/javascript" src="js/share.js"></script>
<script type="text/javascript" src="js/bindcontrol.js"></script>


<script type="text/javascript" src="js/jquery-form.js"></script>

<script type="text/javascript">
$(function(){

	$('#upload').click(function(){
		var busscode = $('#busscode').val();
		
		$("#pageForm").ajaxSubmit({
			type: "POST",
			url:"upload.do",
			data: {"busscode": busscode},   //文件上传到服务器的目录名称
			dataType: "json",
		    success: function(data){
		    	alert(JSON.stringify(data));
			}
		});
	})
})
</script>

</head>
<body>
	<form id="pageForm" method="post" enctype="multipart/form-data">  
		<input type="file" name="file" /> 
		<input type="file" name="file" /> 
	</form>  
	
	上传文件类别（DM_WJLB）：<input type="text" id="busscode" value="01" />
	<br />
	<input type="button" id="upload" value="upload" />

	<input id="tableid" name="file" multiple type="file" data-show-caption="true">
		        
</body>

<script>
    $(document).ready(function () {
        initFileInput("tableid");
		
    });

    function initFileInput(ctrlName) {
        var control = $('#' + ctrlName);
        control.fileinput({
            theme: 'explorer-fa',
            language: 'zh', //设置语言
            uploadUrl: "upload_fileinput.do", //上传的地址
//             allowedFileExtensions: ['jpg', 'gif', 'png'],//接收的文件后缀
            uploadExtraData:{"busscode":'02'},
            uploadAsync: true, //默认异步上传
            showUpload: true, //是否显示上传按钮
            showRemove : true, //显示移除按钮
            showPreview : true, //是否显示预览
            showCaption: false,//是否显示标题
            browseClass: "btn btn-primary", //按钮样式
            //dropZoneEnabled: true,//是否显示拖拽区域
            //minImageWidth: 50, //图片的最小宽度
            //minImageHeight: 50,//图片的最小高度
            //maxImageWidth: 1000,//图片的最大宽度
            //maxImageHeight: 1000,//图片的最大高度
            //maxFileSize: 0,//单位为kb，如果为0表示不限制文件大小
            //minFileCount: 0,
            //maxFileCount: 10, //表示允许同时上传的最大文件个数
            enctype: 'multipart/form-data',
            validateInitialCount:true,
            previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
            msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",

        }).on('filepreupload', function(event, data, previewId, index) {     //上传中
            var form = data.form, files = data.files, extra = data.extra,
            response = data.response, reader = data.reader;
            console.log('文件正在上传');
        }).on("fileuploaded", function (event, data, previewId, index) {    //一个文件上传成功
            console.log('文件上传成功！'+data.id);
        }).on('fileerror', function(event, data, msg) {  //一个文件上传失败
            console.log('文件上传失败！'+data.id);
        })
    }
</script>
</html>



